Carbon


MPAllocateAligned

Header: Multiprocessing.h Carbon status: Supported

Allocates a nonrelocatable memory block.

LogicalAddress MPAllocateAligned (
    ByteCount size, 
    UInt8 alignment, 
    OptionBits options
);
size

The size, in bytes, of the memory block to allocate.

alignment

The desired alignment of the allocated memory block. See “Memory Allocation Alignment Constants” for a list of possible values to pass. Note that there will be a minimum alignment regardless of the requested alignment. If the requested memory block is 4 bytes or smaller, the block will be at least 4-byte aligned. If the requested block is greater than 4 bytes, the block will be at least 8-byte aligned.

options

Any optional information to use with this call. See “Memory Allocation Option Constants” for a list of possible values to pass.

function result

A pointer to the allocated memory. If the function cannot allocate the requested memory or the requested alignment, the returned address is NULL.

DISCUSSION

The memory referenced by the returned address is guaranteed to be accessible by the application's cooperative task and any preemptive tasks that it creates, but not by other applications or their preemptive tasks. Any existing nonglobal heap blocks are freed when the application terminates. As with all shared memory, you must explicitly synchronize access to allocated heap blocks using a notification mechanism.

You can replicate the effect of the older MPAllocate function by calling MPAllocateAligned with 32-byte alignment and no options.

Also see the function MPFree.

VERSION NOTES

Introduced with Multiprocessing Services 2.0.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when MPLibrary 2.0 or later is installed. Exported by CarbonLib 1.0 and later and by MPLibrary 2.0 and later.


© 2000 Apple Computer, Inc. — (Last Updated 4/6/2000)